/*
*  Copyright 2019-2020  Sun Feng
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package com.bluefox.modules.quartz.domain;

import lombok.Data;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import javax.persistence.*;
import java.sql.Timestamp;
import java.io.Serializable;

/**
* @website https://el-admin.vip
* @description /
* @author Sun Feng
* @date 2020-07-16
**/
@Entity
@Data
@Table(name="quartz_log")
public class QuartzLog implements Serializable {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id")
    private Long id;
    /**
     * 任务名称
     */
    @Column(name = "job_name")
    private String jobName;

    /**
     * 实体名称
     */
    @Column(name = "bean_name")
    private String beanName;
    /**
     * 方法名称
     */
    @Column(name = "method_name")
    private String methodName;
    /**
     * 参数
     */
    @Column(name = "params")
    private String params;
    /**
     * 任务表达式
     */
    @Column(name = "cron_expression")
    private String cronExpression;
    /**
     * 是否成功
     */
    @Column(name = "is_success")
    private Boolean isSuccess;
    /**
     * 执行详情
     */
    @Column(name = "exception_detail")
    private String exceptionDetail;
    /**
     * 执行时间
     */
    @Column(name = "time")
    private Long time;
    /**
     * 创建时间
     */
    @Column(name = "create_time")
    private Timestamp createTime;

    public void copy(QuartzLog source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}
